#pragma once
#include "Com.hpp"

class Client
{
public:
    Client() : _fd(gdefaultId)
    {
    }
    bool OpenPipe()
    {
        _fd = open(gfilename.c_str(), O_WRONLY);
        if (_fd < 0)
        {
            std::cerr << "open error" << std::endl;
            return false;
        }
        return true;
    }
    int WritePipe(const std::string& in)
    {
        return ::write(_fd,in.c_str(),in.size());
    }
    void ClosePipe()
    {
        if (_fd >= 0)
            ::close(_fd);
    }
    ~Client()
    {
    }

private:
    int _fd;
};